<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<link rel="stylesheet" href="https://apps.bdimg.com/libs/jquerymobile/1.4.5/jquery.mobile-1.4.5.min.css">
		<script src="https://apps.bdimg.com/libs/jquery/1.10.2/jquery.min.js"></script>
		<script src="https://apps.bdimg.com/libs/jquerymobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
		<title>账户余额</title>
		<link rel="stylesheet" href="css/style.css" />
		<script>
			//若用户未登录，则需先登录
			var logstatu = sessionStorage['LoginName'];
			console.log("name is " + name);
			console.log("statu is " + logstatu);
			if (!logstatu) {
				location.href = 'c_login.html';
				console.log(logstatu);
			}
		</script>
		<script src="js/login/register.js"></script>
		<script>
			var user = getUser();
		</script>
		
		<style>
		#balance{
			margin: 0 auto;
			text-align: center;
			color: #FFAA00;
		}
		#balance p{
			font-size: 2rem;
		}
		</style>
	</head>
	<body>
		<div data-role="page">
			<div data-role="header" id="opcitybg">
				<a id="headop" href="#" data-role="button" data-rel="back" data-icon="carat-l" data-iconpos="notext"></a>
				<h1>账户充值</h1>
			</div>

			<div data-role="main" class="ui-content">
				<form method="get" action="c_accountBalance.html">
					<div class="ui-field-contain">
						<div id="balance">
							<h1>账户余额￥</h1>
							<p><script> document.write(user.balance)</script></p>
						</div>
						<label for="money">输入金额:</label>
						<input type="text" name="money" id="money">
						<label for="password">支付密码:</label>
						<input type="password" name="password" id="password">
					</div>
					<div id="cbt">
						<input type="button" id="updateBan" data-inline="true" value="充值">
						<input type="button" id="declineBan" data-inline="true" value="提现">
					</div>


					<div data-role="footer" data-position="fixed" id="footerbg">
						<p style="text-align:center;color:#FFAA00">copyright@chen</p>
					</div>
				</form>
			</div>
		</div>
	</body>
	
	<script type="text/javascript">
		
		$("#updateBan").click(function(){
			if(user.password==$("#password").val()){
				updateBalance($("#money").val());
				location.href="c_accountBalance.html";
			}else{
				alert("支付密码错误")
			}
		});
		
		$("#declineBan").click(function(){
			if(user.password==$("#password").val()){
				declineBalance($("#money").val());
				location.href="c_accountBalance.html"
			}else{
				alert("支付密码错误")
			}
		});
	</script>
</html>
